﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using System.Windows;

namespace BBInterfaceNET.PropertiesWindow.Converters
{
    public class NullToVisibilityConverter:IValueConverter
    {
        public bool Inverse { get; set; }
        public bool Collapsed { get; set; }

        public NullToVisibilityConverter()
        {
            Inverse = false;
            Collapsed = false;
        }
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value == null)
            {
                if (Inverse)
                    return Visibility.Visible;
                else if (Collapsed)
                    return Visibility.Collapsed;
                else
                    return Visibility.Hidden;
            }
            if (!Inverse)
                return Visibility.Visible;
            else if (Collapsed)
                return Visibility.Collapsed;
            else
                return Visibility.Hidden;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
